<template>
	<view >
		<text >{{title}}</text>
		<image :src="url" />
		<view>
		<view v-for="(item,index) in names"
			:key="index"
			:class="{box111:index === selindex}"
			@click="setIndexNum(index)">
				{{item}}
		</view>
		</view>
		<button type="primary" @click="toPath">路由跳转 toNews</button>
		<button type="primary" @click="toPath1">路由跳转 toOne</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello test',
				url:"https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
				names:["张学有","六德华","马德华","刘德华"],
				selindex:0
			}
		},
		onLoad() {

		},
		methods: {
			setIndexNum(index){
				this.selindex = index;
			},
			// tabbar跳转
			toPath(){
				uni.switchTab({
					url:"../news/news"
				})
			},
			// 其他页面跳转，用navigateTo ，参数可以在目标页面onLoad生命周期中获取
			toPath1(){
				uni.navigateTo({
					url:"../one/one?name=Meas"
				})
			}
		}
	}
</script>

<style>
	
		
		.box111{
			background: yellow;
		}
</style>
